#include "GlobalQueryHandlerAO.h"
#include <avkon.hrh> //EAknSoftkeyOk, EAknSoftkeyCancel, EAknSoftkeyDone
 
CGlobalQueryHandlerAO::~CGlobalQueryHandlerAO() 
	{ 
	Cancel(); 
	}
 
void CGlobalQueryHandlerAO::ConstructL()
    {
    CActiveScheduler::Add(this);
    }
 
CGlobalQueryHandlerAO* CGlobalQueryHandlerAO::NewLC(MGlobalQueryObserver& aObserver)
    {
    CGlobalQueryHandlerAO* self = new (ELeave) CGlobalQueryHandlerAO(aObserver);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }
 
CGlobalQueryHandlerAO* CGlobalQueryHandlerAO::NewL(MGlobalQueryObserver& aObserver)
    {
    CGlobalQueryHandlerAO* self = CGlobalQueryHandlerAO::NewLC(aObserver);
    CleanupStack::Pop(self);
    return self;
    }
 
void CGlobalQueryHandlerAO::DoCancel()
	{
	
	}
 
void CGlobalQueryHandlerAO::StartHandler() 
	{
	SetActive(); 
	}
 
void CGlobalQueryHandlerAO::RunL()
    {
    if (iStatus == EAknSoftkeyRead || iStatus == EAknSoftkeyYes || iStatus == EAknSoftkeyOk)
        iObserver.ProcessOkOptionL();
    else if(iStatus == EAknSoftkeyExit || iStatus == EAknSoftkeyCancel)
        iObserver.ProcessCancelOptionL();
    else if(iStatus == EAknSoftkeyDone)
        iObserver.ProcessDoneOptionL();
    else //if (iStatus == EAknSoftkeySelect)
        iObserver.ProcessSelectedItemL(iStatus.Int());
        
    Cancel();
    }
